/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.feiyue.basic.reader.util;

import android.app.Activity;
import android.content.ContentResolver;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.provider.Settings.System;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;

public class LightUtil {
	public static boolean isAutoBrightness(ContentResolver paramContentResolver) {
		try {
			int i = Settings.System.getInt(paramContentResolver,
					"screen_brightness_mode");
			return (i == 1);
		} catch (Settings.SettingNotFoundException localSettingNotFoundException) {
			localSettingNotFoundException.printStackTrace();
		}
		return false;
	}

	public static void setLight(float paramFloat, Activity paramActivity) {
		WindowManager.LayoutParams localLayoutParams = paramActivity
				.getWindow().getAttributes();
		localLayoutParams.screenBrightness = paramFloat;
		paramActivity.getWindow().setAttributes(localLayoutParams);
	}

	public static void startAutoBrightness(Activity paramActivity) {
		Settings.System.putInt(paramActivity.getContentResolver(),
				"screen_brightness_mode", 1);
	}

	public static void stopAutoBrightness(Activity paramActivity) {
		Settings.System.putInt(paramActivity.getContentResolver(),
				"screen_brightness_mode", 0);
	}
}